#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int tr[N][10], tag[N], tot;
int newnode() {
  ++tot;
  rep(i, 0, 9) tr[tot][i] = 0;
  tag[tot] = 0;
  return tot;
}
bool insert(string& s) {
  bool res = false;
  int p = 0;
  for (char c : s) {
    int ch = c - '0';
    if (!tr[p][ch]) tr[p][ch] = newnode();
    p = tr[p][ch];
    if (tag[p]) res = true;
  }
  tag[p] = 1;
  rep(ch, 0, 9) if (tr[p][ch]) res = true;
  return res;
}
void solve() {
  bool res = true;
  tot = 0;
  rep(i, 0, 9) tr[0][i] = 0;
  cin >> n;
  rep(i, 1, n) {
    string s;
    cin >> s;
    if (insert(s)) res = false;
  }
  cout << (res ? "YES" : "NO") << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}